package entity.device.dto;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import entity.device.EquipmentArchives;


public class EquipmentArchivesQueryWrapper {
    public QueryWrapper<EquipmentArchives> conditional(EquipmentArchives equipmentArchives) {
        QueryWrapper<EquipmentArchives> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("delete_flag", 0);
        if (equipmentArchives.getEquipmentNumber() != null) {
            queryWrapper.like("equipment_number", equipmentArchives.getEquipmentNumber());
        }
        if (equipmentArchives.getDevicename() != null) {
            queryWrapper.like("devicename", equipmentArchives.getDevicename());
        }
        if (equipmentArchives.getSpecificationsModels() != null) {
            queryWrapper.like("specifications_models", equipmentArchives.getSpecificationsModels());
        }
        if (equipmentArchives.getDeviceType() != null) {
            queryWrapper.eq("device_type", equipmentArchives.getDeviceType());
        }
        if (equipmentArchives.getPlaceForStorage() != null) {
            queryWrapper.like("place_for_storage", equipmentArchives.getPlaceForStorage());
        }
        if (equipmentArchives.getCurrentStatus() != null) {
            queryWrapper.eq("current_status", equipmentArchives.getCurrentStatus());
        }
        if (equipmentArchives.getUserDepartment() != null) {
            queryWrapper.eq("user_department", equipmentArchives.getUserDepartment());
        }
        if (equipmentArchives.getPrincipal() != null) {
            queryWrapper.eq("principal", equipmentArchives.getPrincipal());
        }
        if (equipmentArchives.getActivationDate() != null) {
            queryWrapper.like("Activation_date", equipmentArchives.getActivationDate());
        }
        if (equipmentArchives.getSupplier() != null) {
            queryWrapper.eq("supplier", equipmentArchives.getSupplier());
        }
        if (equipmentArchives.getOperator() != null) {
            queryWrapper.eq("operator", equipmentArchives.getOperator());
        }
        if (equipmentArchives.getUpdateTime() != null) {
            queryWrapper.like("update_time", equipmentArchives.getUpdateTime());
        }

        return queryWrapper;
    }
}
